package com.manor.paradise.adapter

import android.widget.ImageView
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.manor.paradise.R
import com.manor.paradise.bean.AuraValueBean
import java.math.BigDecimal

class AuraValueAdapter(layoutResId: Int, data: MutableList<AuraValueBean.RecordsBean>?) : BaseQuickAdapter<AuraValueBean.RecordsBean, BaseViewHolder>
(layoutResId, data) {

    override fun convert(helper: BaseViewHolder, item: AuraValueBean.RecordsBean) {
        var tv_name = helper.getView<TextView>(R.id.tv_name)

        var im_istop = helper.getView<ImageView>(R.id.im_istop)
        var tv_time = helper.getView<TextView>(R.id.tv_time)
        var tv_context = helper.getView<TextView>(R.id.tv_context)

        val num = if (item.anima != null) {
            if (item.anima > BigDecimal.ZERO)
                "+" + item.anima.toString()
            else
                "-" + item.anima.toString()
        } else
            ""

        tv_context.text = num
        tv_time.text = item.createTime

        tv_name.text = item.content
        if (item.anima >= BigDecimal.ZERO) {
            im_istop.setImageResource(R.mipmap.pic_aura_list_top)
        } else {
            im_istop.setImageResource(R.mipmap.pic_aura_list_btn)
        }
    }


}